package com.biz.controller.Jobs;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.biz.executor.TestExecutor;
import com.framework.controller.BaseController;

/**
 * 会员归属地计算
 * 
 * @author yx
 *
 */
@Controller
@RequestMapping("/jobservice")
public class TestController extends BaseController {

	private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class);

	@Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
	
	@Autowired
    private TestExecutor testExecutor;

	@RequestMapping(value = "/test")
    @ResponseBody
    public Map<String, Object> test(HttpServletRequest request) {
		LOGGER.info("into method TestController.test...");
		
		testExecutor.setId(100);
		
		threadPoolTaskExecutor.execute(testExecutor);
		
		Map<String, Object> resultMap = new HashMap<String, Object>();
        resultMap.put("id", 100);
        resultMap.put("descCode", "00100000");
        resultMap.put("descMsg", "");
        
        LOGGER.info("out of method TestController.test...");
		
		return resultMap;
	}
}
